/*
 * pins.h
 *
 *  Created on: Dec 10, 2011
 *      Author: Michael Anderson
 *      Part of Team 955 Battery Cart project
 *      compiled on Eclipse with Arduino libraries and avr-gcc
 *
 *  Important note regarding pins:
 *  analogWrite will not work for pins 9 and 10 due
 *  to the use of hardware interrupts!
 */

#ifndef PINS_H_
#define PINS_H_

#include "enums.h"

//Chargers
const uint8_t PINS_CHARGER[NUM_CHARGING_CIRCUITS] = { 47,46,43,38 };

//Conditioners
const uint8_t PINS_LOADS[NUM_CONDITIONERS][NUM_LOADS] = {
        { 50,49,48 },
        { 42,41,40 }
};

enum conditioner_pin_type {
    PIN_TYPE_COND_20_WATT = 0,
    PIN_TYPE_COND_100_WATT,
    PIN_TYPE_COND_200_WATT
};

//Inverters
const uint8_t PINS_INVERTER[NUM_CHARGING_CIRCUITS] =  { 53,52,45,44 };

//Voltage and Current
const uint8_t PINS_MEASUREMENT[NUM_CONDITIONERS][2] = {
        { A0, A3 },
        { A1, A2 }
};

enum measurement_pin_type {
    PIN_TYPE_MEASUREMENT_VOLTAGE = 0,
    PIN_TYPE_MEASUREMENT_CURRENT
};

//Displays
const uint8_t PINS_DISPLAY[][11] = {
        { 4,3,2,37,36,35,34,33,32,31,30 },
        { 4,3,2,37,36,35,34,33,32,31,30 }
};

enum display_pin_type {
    PIN_TYPE_DISPLAY_RS = 0,
    PIN_TYPE_DISPLAY_RW,
    PIN_TYPE_DISPLAY_ENABLE,
    PIN_TYPE_DISPLAY_D0,
    PIN_TYPE_DISPLAY_D1,
    PIN_TYPE_DISPLAY_D2,
    PIN_TYPE_DISPLAY_D3,
    PIN_TYPE_DISPLAY_D4,
    PIN_TYPE_DISPLAY_D5,
    PIN_TYPE_DISPLAY_D6,
    PIN_TYPE_DISPLAY_D7
};

#endif /* PINS_H_ */
